import store from '@/store'
export function checkPermission(val) {
  const permissions = store.getters && store.getters.permissions
  let value = [val]
  if (value && value instanceof Array) {
    if (value.length > 0) {
      const permissionBtns = value
      let checker = (arr, target) => target.every((v) => arr.includes(v))
      const hasPermission = checker(permissions, permissionBtns)
      if (!hasPermission) {
        return false
      }
    }
    return true
  } else {
    return false
  }
}
